{{csrf_field()}}
<div class="layui-form-item">
    <label for="" class="layui-form-label">上级分类</label>
    <div class="layui-input-block">
        <select name="parent_id" lay-search  lay-filter="parent_id">
            <option value="0">一级分类</option>
            @if(count($attributes))
            @foreach($attributes as $first)
                <option value="{{ $first['id'] }}" @if(isset($attribute->parent_id)&&$attribute->parent_id==$first['id']) selected @endif>{{ $first['name'] }}</option>
                @if(isset($first['_child']))
                    @foreach($first['_child'] as $second)
                        <option value="{{$second['id']}}" {{ isset($attribute->id) && $attribute->parent_id==$second['id'] ? 'selected' : '' }} >&nbsp;&nbsp;┗━━{{$second['name']}}</option>
                        @if(isset($second['_child']))
                            @foreach($second['_child'] as $third)
                                <option value="{{$third['id']}}" {{ isset($attribute->id) && $attribute->parent_id==$third['id'] ? 'selected' : '' }} >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;┗━━{{$third['name']}}</option>
                            @endforeach
                        @endif
                    @endforeach
                @endif
            @endforeach
            @endif
        </select>
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">名称</label>
    <div class="layui-input-block">
        <input type="text" name="name" value="{{ $attribute->name ?? old('name') }}" lay-verify="required" placeholder="请输入名称" class="layui-input" >
    </div>
</div>
{{--<div class="layui-form-item">--}}
{{--    <label for="" class="layui-form-label">唯一标识</label>--}}
{{--    <div class="layui-input-block">--}}
{{--        <input type="text" name="uniqueid" value="{{ $attribute->uniqueid ?? old('uniqueid') }}" placeholder="推荐使用26个英文字母，如：A B C 等，避免同级栏目重复(重要)" class="layui-input" >--}}
{{--    </div>--}}
{{--</div>--}}
{{--<div class="layui-form-item">--}}
{{--    <label for="" class="layui-form-label">属性字段</label>--}}
{{--    <div class="layui-input-block">--}}
{{--        <input type="text" name="attr" value="{{ $attribute->attr ?? old('attr') }}" placeholder="如：price" class="layui-input" >--}}
{{--    </div>--}}
{{--</div>--}}
<div class="layui-form-item">
    <label for="" class="layui-form-label">排序</label>
    <div class="layui-input-block">
        <input type="text" name="sort" value="{{ $attribute->sort ?? 0 }}" lay-verify="required|number" placeholder="请输入数字" class="layui-input" >
    </div>
</div>
<div class="layui-form-item" style="display: flex;">
    <div class="layui-inline">
        <label for="" class="layui-form-label">地图标注</label>
        <div class="layui-input-inline" style="width:300px;">
            <input type="text" name="map" id="map" value="{{$attribute->map??old('map')}}" placeholder="仅限添加区域时使用，其他请忽略" class="layui-input" >
        </div>
    </div>
    <button type="button" class="layui-btn layui-btn-danger"  id="getmap">获取标注</button>
{{--    <input type="hidden" id="uri" value="{{env('APP_URI')}}">--}}
</div>
{{--<div class="layui-form-item">--}}
{{--    <label for="" class="layui-form-label">类型 *</label>--}}
{{--    <div class="layui-input-block">--}}
{{--        <input type="radio" name="attr_type" value="1" title="新房" @if(isset($attribute->attr_type) && $attribute->attr_type == 1) checked @elseif(!isset($attribute->attr_type)) checked @endif>--}}
{{--        <input type="radio" name="attr_type" value="2" title="二手/出租" @if(isset($attribute->attr_type) && $attribute->attr_type == 2) checked @endif>--}}
{{--        <input type="radio" name="attr_type" value="0" title="通用" @if(isset($attribute->attr_type) && $attribute->attr_type == 0) checked @endif>--}}
{{--    </div>--}}
{{--</div>--}}
<div class="layui-form-item">
    <label for="" class="layui-form-label">状态 *</label>
    <div class="layui-input-block">
        <input type="radio" name="status" value="T" title="启用" @if(isset($attribute->status) && $attribute->status == 'T') checked @elseif(!isset($attribute->status)) checked @endif>
        <input type="radio" name="status" value="F" title="禁用" @if(isset($attribute->status) && $attribute->status == 'F') checked @endif>
    </div>
</div>
<div class="layui-form-item">
    <div class="layui-input-block">
        <button type="submit" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="formDemo">确 认</button>
        <a  class="layui-btn" href="{{route('admin.property.attribute')}}" >返 回</a>
    </div>
</div>

